﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using Capstone_project.DatabaseAccessLayer;
using Capstone_project.BussinessObject;

namespace Capstone_project.BussnessLogicLayer
{
    class UserAccountBUS
    {
        ConnectData connData = new ConnectData();
        public userAccount getAccountInfor(string un)
        {
            string sql = "SELECT USER_NAME,ID_GROUP,LEVEL,PASS_WORD,EMAIL,FROM USER_ACCOUNT ACC, GROUP GR WHERE ACC.ID_GROUP=GR.ID_GROUP AND USER_NAME='"+un+"'";
            DataRow drAccount = connData.getData(sql).Rows[0];
            userAccount account = new userAccount();
            account.USER_NAME = drAccount["USER_NAME"].ToString();
            account.ID_GROUP = drAccount["ID_GROUP"].ToString();
            account.LEVEL = drAccount["LEVEL"].ToString();
            account.PASS_WORD = drAccount["PASS_WORD"].ToString();
            account.EMAIL = drAccount["EMAIL"].ToString();
            return account;
        }
    }
}
